const C = require('memory-cache')

module.exports = {
  all_foods_by_shop: shop_id => {
    return C.get('foods').filter(food => food.shop_id == shop_id)
  },
  get: id => {
    return C.get('foods').find(food => food.id == id)
  },
  add: (shop_id,food) => {
    const foods = C.get('foods')
    foods.push({id: foods.length,...food,shop_id})
    C.put('foods',foods)
  }
}